package org.third.common.domain;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "k8s_instance")
public class KubeInstance {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id")
	private Long id;

	@Column(name = "type", nullable = false)
	private String type;
	
	@Column(name = "api_version", nullable = false)
	private String apiVersion;
	
	@Column(name = "name", nullable = false)
	private String instanceName;
	
	@Column(name = "namespace")
	private String namespace;
	
	@Column(name = "yaml_content")
	@Lob
	private String content;
	
	@Column(name = "response_body", nullable = false)
	@Lob
	private String responseBody;
	
	@Column(name = "response_status_code", nullable = false)
	private int statusCode;
	
	@Column(name = "execute_success", nullable = false)
	private boolean executeSuccess;
	
	@ManyToOne(cascade=CascadeType.ALL,fetch = FetchType.LAZY)
	@JoinColumn(name = "kube_batch_job_id")
	private KubeBatchJob kubeBatchJob;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getApiVersion() {
		return apiVersion;
	}

	public void setApiVersion(String apiVersion) {
		this.apiVersion = apiVersion;
	}

	public String getInstanceName() {
		return instanceName;
	}

	public void setInstanceName(String instanceName) {
		this.instanceName = instanceName;
	}

	public String getNamespace() {
		return namespace;
	}

	public void setNamespace(String namespace) {
		this.namespace = namespace;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getResponseBody() {
		return responseBody;
	}

	public void setResponseBody(String responseBody) {
		this.responseBody = responseBody;
	}

	public int getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(int statusCode) {
		this.statusCode = statusCode;
	}

	public boolean isExecuteSuccess() {
		return executeSuccess;
	}

	public void setExecuteSuccess(boolean executeSuccess) {
		this.executeSuccess = executeSuccess;
	}

	public KubeBatchJob getKubeBatchJob() {
		return kubeBatchJob;
	}

	public void setKubeBatchJob(KubeBatchJob kubeBatchJob) {
		this.kubeBatchJob = kubeBatchJob;
	}
	
}